package com.hc.util.order;

public class OrderParse {
	
	public static OrderEntity parseOrder(String ordername){
		if(ordername==null||"".equals(ordername.trim())||ordername.length()<12){
			return null;
		}
		OrderEntity entity = new OrderEntity();
		
		String buildNo = "";
		String buildFloor = "";
		String unNo = "";
		String time = "";
		String sece = "";
		
		for(int i = 0;i<ordername.length();i++){
			if(i<4){
				buildNo = buildNo + ordername.charAt(i);
			}else if(i<6){
				buildFloor = buildFloor + ordername.charAt(i);
			}else if(i<7){
				unNo = unNo + ordername.charAt(i);
			}else if(i<11){
				time = time + ordername.charAt(i);
			}else if(i<12){
				sece = sece + ordername.charAt(i);
			}
		}
		entity.setBuildNo(buildNo);
		entity.setBuildFloor(buildFloor);
		entity.setUnNo(unNo);
		entity.setTime(time);
		entity.setSece(sece);
		
		return entity;
	}
}
